package com.yang.springcloud.controller;

import com.yang.springcloud.pojo.Dept;
import com.yang.springcloud.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author yds
 * @program springcloud
 * @description 部门表用于提供服务的请求层 restful
 * @create 2020-09-17 15:03
 **/
@RestController
@RequestMapping("/dept")
public class DeptController {

    @Autowired
    private DeptService deptservice;

    @PostMapping("/add")
    public boolean addDept(Dept dept){
        return deptservice.addDept(dept);
    }

    @GetMapping("/query/{id}")
    public Dept queryById(@PathVariable("id") Long id){
        return deptservice.queryById(id);
    }
    @GetMapping("/list")
    public List<Dept> queryAll(){
        return deptservice.queryAll();
    }
}
